package cn.vastbase.jdbc.io;

import org.junit.Test;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;

public class MigrationTestCase {

    /**
     * 从数据库导出到本地文件
     */
   /* @Test
    public void migration() {
        String cname = "org.postgresql.Driver";
        Connection conn = null;
        String url = "jdbc:postgresql://192.168.56.12:6000/test";
        String username = "zxs";
        String passwd = "Vastdata#0730";
        String tableName = "test_bulkload";
        String delimiter = "|";              //定义分隔符
        String encoding = "UTF8";            //定义字符集

        try {
            conn = DriverManager.getConnection(url, username, passwd);
            BaseConnection baseConn = (BaseConnection) conn;
            String sql = "Copy (select * from " + tableName + ") to STDOUT  DELIMITER " + "'" + delimiter + "'" + " ENCODING " + "'" + encoding + "'";
            CopyManager cp = new CopyManager(baseConn);
            cp.copyOut(sql, os);
            baseConn.close();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            close();
        }
    }
*/
    public ResultSet read() {
        return null;
    }


    public ResultSet write() {
        return null;
    }

}
